package com.sunyard.constant.manage;


import com.sunyard.constant.ErrMessageConst;
import com.sunyard.entity.BackResult;
import com.sunyard.utils.JsonUtil;

/**
 * @author k3887
 * @Method
 * @Description TODO
 * @Date 2018/11/29
 * @Param
 * @return
 * @throw
 */
public class CommonConst {

    /**
     * Description
     */
    private CommonConst() {
    }

    //返回失败
    public static final String RET_FAIL = "01";
    //返回成功
    public static final String RET_SUCCESS = "00";
    //登陆成功
    public static final String LOGIN_SUCCESS = "00";
    //密码重置
    public static final String RET_RESET = "02";
    //返回系统异常
    public static final String RET_ERROR = "99";
    //token过期
    public static final String PAST_DUE = "04";
    //用户未登录
    public static final String NOT_LOGIN = "03";
    //账号在其他地方登录
    public static final String OP_OCCUPIED = "03";
    //权限拦截
    public static final String NO_POPEDOM = "03";
    //商户进件返回成功
    public static final String MERCHANT_CREATE_RET_SUCCESS = "00";
    //商户进件返回失败
    public static final String MERCHANT_CREATE_RET_ERROR = "01";
    //商户修改返回失败
    public static final String MERCHANT_UPDATE_RET_ERROR = "02";
    //商户绑定终端返回失败
    public static final String MERCHANT_BIND_RET_ERROR = "04";

    /**
     * Description
     */
    public static final String JSON_SYS_ERROR =
            JsonUtil.ObjectToString(new BackResult(RET_ERROR, ErrMessageConst.SYSTEM_ERROR));
    /**
     * Description
     */
    public static final String JSON_RESET =
            JsonUtil.ObjectToString(new BackResult(RET_RESET, new String("重置密码")));

    /**
     * Description
     */
    public static String getResult(String code, Object obj) {
        return JsonUtil.ObjectToString(new BackResult(code, JsonUtil.ObjectToString(obj)));
    }

    /**
     * Description
     */
    public static String getResult(String code, String obj) {
        return JsonUtil.ObjectToString(new BackResult(code, new String(obj)));
    }


    /**
     * Description
     */
    public static String getResult(BackResult br) {
        return JsonUtil.ObjectToString(br);
    }

}
